﻿@model IEnumerable<FCNS.ERP.Models.ErpSaleOrder>

@{
    ViewBag.Title = ViewData["Flag"];
    Layout = "~/Views/Jxc/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>

<p>
    @{
        var f = (int)ViewData["Flag"];
    }
    <a class="newObjA" href="/Jxc/SaleOrderNew?flag=@f">新增</a>
</p>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.CorSId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.OrderNO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DateTimeStart)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.StoreId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Money)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Advance)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.InvoiceType)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.CorS.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.OrderNO)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DateTimeStart)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Store.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Money)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Advance)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.InvoiceType)
            </td>

            <td>
                @switch (item.SaleStatus)
                {
                    case FCNS.ERP.Models.ErpSaleOrder.EnumSaleStatus.下单:
                        @Html.ActionLink("编辑", "SaleOrderEdit", new { id = item.Id }) @Html.Raw(" | ")
                        @Html.ActionLink("审核", "SaleOrderShenHe", new { id = item.Id }) @Html.Raw(" | ")
                        <a href="SaleOrderDelete/@item.Id" class="objDelete">删除</a>
                        break;

                    case FCNS.ERP.Models.ErpSaleOrder.EnumSaleStatus.审核:
                    case FCNS.ERP.Models.ErpSaleOrder.EnumSaleStatus.待支付预付款:
                        @Html.ActionLink("打印", "ReportPrint", new { flag = 1, id = item.Id, str = "" }, htmlAttributes: new { @target = "_blank" }) @Html.Raw(" | ")
                        <a href="SaleOrderDelete/@item.Id" class="objDelete">删除</a>
                        break;
                }

            </td>


        </tr>
    }

</table>
